﻿namespace HRM.CORE
{
    using DevExpress.Data;
    using DevExpress.Utils;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Grid;
    using APP.HELPER;
    using HRM.CORE;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms; using Common;
    using Common;
    using DevExpress.XtraGrid.Views.Base;
    using Extra.ERP;

    public class xucBirthday : Common.xucBase
    {
        private GridColumn colBirthday;
        private GridColumn colBirthdayDay;
        private GridColumn colBirthdayMonth;
        private GridColumn colBirthdayYear;
        private GridColumn colEmployeeCode;
        private GridColumn colEmployeeName;
        private IContainer components = null;
        private GridView gbList;
        private GridControl gcList;
        private RepositoryItemPictureEdit rptPhoto;

        public xucBirthday()
        {
            this.InitializeComponent();
            this.Init();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Init()
        {
            this.gcList.DataSource = new HRM_EMPLOYEE().GetListBirthday(MyLogin.Level, MyLogin.Code);
        }

        private void InitializeComponent()
        {
            StyleFormatCondition condition = new StyleFormatCondition();
            StyleFormatCondition condition2 = new StyleFormatCondition();
            this.colBirthday = new GridColumn();
            this.gcList = new GridControl();
            this.gbList = new GridView();
            this.colEmployeeCode = new GridColumn();
            this.colEmployeeName = new GridColumn();
            this.colBirthdayDay = new GridColumn();
            this.colBirthdayMonth = new GridColumn();
            this.colBirthdayYear = new GridColumn();
            this.rptPhoto = new RepositoryItemPictureEdit();
            this.gcList.BeginInit();
            this.gbList.BeginInit();
            this.rptPhoto.BeginInit();
            base.SuspendLayout();
            this.colBirthday.Caption = "Ng\x00e0y sinh";
            this.colBirthday.FieldName = "Birthday";
            this.colBirthday.Name = "colBirthday";
            this.colBirthday.OptionsColumn.AllowEdit = false;
            this.colBirthday.OptionsColumn.ReadOnly = true;
            this.colBirthday.UnboundExpression = "[BirthdayDay]+'/'+[BirthdayMonth]+'/'+[BirthdayYear]";
            this.colBirthday.UnboundType = UnboundColumnType.String;
            this.colBirthday.Visible = true;
            this.colBirthday.VisibleIndex = 2;
            this.colBirthday.Width = 0x41;
            this.gcList.Dock = DockStyle.Fill;
            this.gcList.EmbeddedNavigator.Buttons.Append.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.CancelEdit.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.Edit.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.EndEdit.Visible = false;
            this.gcList.EmbeddedNavigator.Buttons.Remove.Visible = false;
            this.gcList.EmbeddedNavigator.TextStringFormat = "{0}/{1}";
            this.gcList.Location = new Point(0, 0);
            this.gcList.MainView = this.gbList;
            this.gcList.Name = "gcList";
            this.gcList.RepositoryItems.AddRange(new RepositoryItem[] { this.rptPhoto });
            this.gcList.Size = new Size(0xea, 0x160);
            this.gcList.TabIndex = 4;
            this.gcList.ViewCollection.AddRange(new BaseView[] { this.gbList });
            this.gbList.Appearance.GroupRow.Font = new Font("Tahoma", 8.25f, FontStyle.Bold);
            this.gbList.Appearance.GroupRow.Options.UseFont = true;
            this.gbList.Appearance.HeaderPanel.Options.UseTextOptions = true;
            this.gbList.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
            this.gbList.Appearance.HeaderPanel.TextOptions.WordWrap = WordWrap.Wrap;
            this.gbList.BorderStyle = BorderStyles.NoBorder;
            this.gbList.Columns.AddRange(new GridColumn[] { this.colEmployeeCode, this.colEmployeeName, this.colBirthdayDay, this.colBirthdayMonth, this.colBirthdayYear, this.colBirthday });
            this.gbList.FixedLineWidth = 1;
            condition.Appearance.ForeColor = Color.Red;
            condition.Appearance.Options.UseForeColor = true;
            condition.ApplyToRow = true;
            condition.Condition = FormatConditionEnum.Expression;
            condition.Expression = "[BirthdayDay] ==GetDay(UtcNow()) And [BirthdayMonth] ==GetMonth(UtcNow())";
            condition2.Appearance.ForeColor = Color.Orange;
            condition2.Appearance.Options.UseForeColor = true;
            condition2.ApplyToRow = true;
            condition2.Condition = FormatConditionEnum.Expression;
            condition2.Expression = "([BirthdayDay]-GetDay(UtcNow())  <= 10)  And ([BirthdayDay]-GetDay(UtcNow())  > 0)";
            this.gbList.FormatConditions.AddRange(new StyleFormatCondition[] { condition, condition2 });
            this.gbList.GridControl = this.gcList;
            this.gbList.GroupPanelText = "K\x00e9o v\x00e0 Thả cột v\x00e0o đ\x00e2y để nh\x00f3m dữ liệu";
            this.gbList.IndicatorWidth = 40;
            this.gbList.Name = "gbList";
            this.gbList.OptionsBehavior.AllowIncrementalSearch = true;
            this.gbList.OptionsBehavior.AutoExpandAllGroups = true;
            this.gbList.OptionsBehavior.CopyToClipboardWithColumnHeaders = false;
            this.gbList.OptionsBehavior.FocusLeaveOnTab = true;
            this.gbList.OptionsBehavior.ReadOnly = true;
            this.gbList.OptionsCustomization.AllowColumnMoving = false;
            this.gbList.OptionsCustomization.AllowColumnResizing = false;
            this.gbList.OptionsCustomization.AllowFilter = false;
            this.gbList.OptionsCustomization.AllowGroup = false;
            this.gbList.OptionsCustomization.AllowSort = false;
            this.gbList.OptionsLayout.StoreAllOptions = true;
            this.gbList.OptionsLayout.StoreAppearance = true;
            this.gbList.OptionsMenu.EnableColumnMenu = false;
            this.gbList.OptionsMenu.EnableGroupPanelMenu = false;
            this.gbList.OptionsNavigation.EnterMoveNextColumn = true;
            this.gbList.OptionsSelection.EnableAppearanceFocusedCell = false;
            this.gbList.OptionsSelection.EnableAppearanceFocusedRow = false;
            this.gbList.OptionsSelection.InvertSelection = true;
            this.gbList.OptionsView.EnableAppearanceEvenRow = true;
            this.gbList.OptionsView.RowAutoHeight = true;
            this.gbList.OptionsView.ShowColumnHeaders = false;
            this.gbList.OptionsView.ShowGroupExpandCollapseButtons = false;
            this.gbList.OptionsView.ShowGroupPanel = false;
            this.gbList.OptionsView.ShowHorzLines = false;
            this.gbList.OptionsView.ShowIndicator = false;
            this.gbList.OptionsView.ShowPreviewLines = false;
            this.gbList.OptionsView.ShowVertLines = false;
            this.colEmployeeCode.Caption = "M\x00e3 NV";
            this.colEmployeeCode.FieldName = "EmployeeCode";
            this.colEmployeeCode.Name = "colEmployeeCode";
            this.colEmployeeCode.OptionsColumn.AllowEdit = false;
            this.colEmployeeCode.OptionsColumn.ReadOnly = true;
            this.colEmployeeCode.Visible = true;
            this.colEmployeeCode.VisibleIndex = 0;
            this.colEmployeeCode.Width = 0x40;
            this.colEmployeeName.Caption = "Họ v\x00e0 t\x00ean";
            this.colEmployeeName.FieldName = "EmployeeName";
            this.colEmployeeName.Name = "colEmployeeName";
            this.colEmployeeName.OptionsColumn.AllowEdit = false;
            this.colEmployeeName.OptionsColumn.ReadOnly = true;
            this.colEmployeeName.Visible = true;
            this.colEmployeeName.VisibleIndex = 1;
            this.colEmployeeName.Width = 0x69;
            this.colBirthdayDay.Caption = "Ng\x00e0y sinh (*)";
            this.colBirthdayDay.FieldName = "BirthdayDay";
            this.colBirthdayDay.Name = "colBirthdayDay";
            this.colBirthdayMonth.Caption = "Th\x00e1ng sinh";
            this.colBirthdayMonth.FieldName = "BirthdayMonth";
            this.colBirthdayMonth.Name = "colBirthdayMonth";
            this.colBirthdayYear.Caption = "Năm sinh";
            this.colBirthdayYear.FieldName = "BirthdayYear";
            this.colBirthdayYear.Name = "colBirthdayYear";
            this.rptPhoto.CustomHeight = 0x30;
            this.rptPhoto.Name = "rptPhoto";
            this.rptPhoto.NullText = "[Chưa chọn h\x00ecnh]";
            this.rptPhoto.SizeMode = PictureSizeMode.Zoom;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.gcList);
            base.Name = "xucBirthday";
            base.Size = new Size(0xea, 0x160);
            this.gcList.EndInit();
            this.gbList.EndInit();
            this.rptPhoto.EndInit();
            base.ResumeLayout(false);
        }
    }
}

